Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Phpunit 10 and dev tools script #119

Merged
merged 11 commits into from
Mar 14, 2024
Merged

Phpunit 10 and dev tools script #119

merged 11 commits into from
Mar 14, 2024

Conversation

mattbell87
Copy link
Member

@mattbell87 mattbell87 commented Mar 4, 2024

Changelog

Phpunit 10

This seems to run OK if you keep the filename the same as the class name. So I've separated tests in to subdirectories instead and I've tested to see if they execute the same. It seems to work great, no warnings/errors.

Please review, happy to refactor if needed.

Dev tools script

When I went to install phpunit 10 I noticed another problem. We have phpunit 8 defined in many other places.

Currently there are several test platforms. This is to provide a single source of truth for the test platform. I would like this to eventually be used locally, in CI and in codespaces. The idea is if any of these dev tool packages require an update, just change one of these files and it would propagate to all systems.

It's based on the CI in cmfive-core.

Removal of codeception and selenium

As discussed with @DerekCrannaford we've decided to drop these from the develop branch as they are no longer used. @Dane-2pi heads up this will likely affect codespaces. I will get a PR ready.

Test PHPUnit 10

To test PHPUnit 10, run .codepipeline/docker/install_dev_tools.sh then docker compose exec webapp php cmfive.php tests unit all.

Documentation

The scripts are well commented. Cmfive documentation could be created for .codepipeline/docker/install_dev_tools.sh for devs without a codespace, perhaps when it's more widely used.

Copy link

github-actions bot commented Mar 4, 2024

Overview

Image reference ghcr.io/2pisoftware/cmfive:develop ghcr.io/2pisoftware/cmfive:pr-119
- digest c2eca81271e7 33d06f8b02e1
- provenance 4f0244d 91f8b7a
- vulnerabilities critical: 0 high: 3 medium: 8 low: 0 unspecified: 1 critical: 0 high: 3 medium: 8 low: 0 unspecified: 1
- platform linux/amd64 linux/amd64
- size 329 MB 357 MB (+28 MB)
- packages 205 205
Base Image alpine:3
also known as:
3.19
3.19.1
latest
alpine:3
also known as:
3.19
3.19.1
latest
- vulnerabilities critical: 0 high: 0 medium: 0 low: 0 critical: 0 high: 0 medium: 0 low: 0
Labels (3 changes)
  • ± 3 changed
  • 6 unchanged
-org.opencontainers.image.created=2024-03-13T03:00:48.546Z
+org.opencontainers.image.created=2024-03-14T01:50:19.710Z
 org.opencontainers.image.description=Cmfive in a docker image
 org.opencontainers.image.licenses=GPL-3.0
-org.opencontainers.image.revision=4f0244d3b1021dae8718b43da0f620da160672a4
+org.opencontainers.image.revision=91f8b7a16c84e070566546122f21908fa9c29788
 org.opencontainers.image.source=https://github.com/2pisoftware/cmfive-boilerplate
 org.opencontainers.image.title=Cmfive
 org.opencontainers.image.url=https://github.com/2pisoftware/cmfive-boilerplate
 org.opencontainers.image.vendor=2pisoftware
-org.opencontainers.image.version=develop
+org.opencontainers.image.version=pr-119

Copy link

github-actions bot commented Mar 4, 2024

🔍 Vulnerabilities of ghcr.io/2pisoftware/cmfive:pr-119

📦 Image Reference ghcr.io/2pisoftware/cmfive:pr-119
digestsha256:33d06f8b02e1954069d819cc38d532fa3d789481cca8871d540c58ea197273a6
vulnerabilitiescritical: 0 high: 3 medium: 8 low: 0
platformlinux/amd64
size357 MB
packages205
📦 Base Image alpine:3
also known as
  • 3.19
  • 3.19.1
  • latest
digestsha256:6457d53fb065d6f250e1504b9bc42d5b6c65941d57532c072d929dd0628977d0
vulnerabilitiescritical: 0 high: 0 medium: 0 low: 0
critical: 0 high: 1 medium: 0 low: 0 twig/twig 3.3.10 (composer)

pkg:composer/twig/[email protected]

high 7.5: CVE--2022--39261 Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')

Affected range>=3.0.0
<3.4.3
Fixed version3.4.3
CVSS Score7.5
CVSS VectorCVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N
Description

Description

When using the filesystem loader to load templates for which the name is a user input, it is possible to use the source or include statement to read arbitrary files from outside the templates directory when using a namespace like @somewhere/../some.file (in such a case, validation is bypassed).

Resolution

We fixed validation for such template names.

Even if the 1.x branch is not maintained anymore, a new version has been released.

Credits

We would like to thank Dariusz Tytko for reporting the issue and Fabien Potencier for fixing the issue.

critical: 0 high: 1 medium: 0 low: 0 chart.js 2.5.0 (npm)

pkg:npm/[email protected]

high 7.5: CVE--2020--7746 Improperly Controlled Modification of Object Prototype Attributes ('Prototype Pollution')

Affected range<2.9.4
Fixed version2.9.4
CVSS Score7.5
CVSS VectorCVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H
Description

This affects the package chart.js before 2.9.4. The options parameter is not properly sanitized when it is processed. When the options are processed, the existing options (or the defaults options) are deeply merged with provided options. However, during this operation, the keys of the object being set are not checked, leading to a prototype pollution.

critical: 0 high: 1 medium: 0 low: 0 libxml2 2.11.7-r0 (apk)

pkg:apk/alpine/[email protected]?os_name=alpine&os_version=3.19

high : CVE--2024--25062

Affected range<2.12.5-r0
Fixed version2.12.5-r0
Description
critical: 0 high: 0 medium: 5 low: 0 jquery-ui 1.10.4 (npm)

pkg:npm/[email protected]

medium 6.5: CVE--2021--41184 Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')

Affected range<1.13.0
Fixed version1.13.0
CVSS Score6.5
CVSS VectorCVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:H/A:N
Description

Impact

Accepting the value of the of option of the .position() util from untrusted sources may execute untrusted code. For example, invoking the following code:

$( "#element" ).position( {
	my: "left top",
	at: "right bottom",
	of: "<img onerror='doEvilThing()' src='/404' />",
	collision: "none"
} );

will call the doEvilThing() function.

Patches

The issue is fixed in jQuery UI 1.13.0. Any string value passed to the of option is now treated as a CSS selector.

Workarounds

A workaround is to not accept the value of the of option from untrusted sources.

For more information

If you have any questions or comments about this advisory, search for a relevant issue in the jQuery UI repo. If you don't find an answer, open a new issue.

medium 6.5: CVE--2021--41183 Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')

Affected range<1.13.0
Fixed version1.13.0
CVSS Score6.5
CVSS VectorCVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:H/A:N
Description

Impact

Accepting the value of various *Text options of the Datepicker widget from untrusted sources may execute untrusted code. For example, initializing the datepicker in the following way:

$( "#datepicker" ).datepicker( {
	showButtonPanel: true,
	showOn: "both",
	closeText: "<script>doEvilThing( 'closeText XSS' )</script>",
	currentText: "<script>doEvilThing( 'currentText XSS' )</script>",
	prevText: "<script>doEvilThing( 'prevText XSS' )</script>",
	nextText: "<script>doEvilThing( 'nextText XSS' )</script>",
	buttonText: "<script>doEvilThing( 'buttonText XSS' )</script>",
	appendText: "<script>doEvilThing( 'appendText XSS' )</script>",
} );

will call doEvilThing with 6 different parameters coming from all *Text options.

Patches

The issue is fixed in jQuery UI 1.13.0. The values passed to various *Text options are now always treated as pure text, not HTML.

Workarounds

A workaround is to not accept the value of the *Text options from untrusted sources.

For more information

If you have any questions or comments about this advisory, search for a relevant issue in the jQuery UI repo. If you don't find an answer, open a new issue.

medium 6.5: CVE--2021--41182 Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')

Affected range<1.13.0
Fixed version1.13.0
CVSS Score6.5
CVSS VectorCVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:H/A:N
Description

Impact

Accepting the value of the altField option of the Datepicker widget from untrusted sources may execute untrusted code. For example, initializing the datepicker in the following way:

$( "#datepicker" ).datepicker( {
	altField: "<img onerror='doEvilThing()' src='/404' />",
} );

will call the doEvilThing function.

Patches

The issue is fixed in jQuery UI 1.13.0. Any string value passed to the altField option is now treated as a CSS selector.

Workarounds

A workaround is to not accept the value of the altField option from untrusted sources.

For more information

If you have any questions or comments about this advisory, search for a relevant issue in the jQuery UI repo. If you don't find an answer, open a new issue.

medium 6.1: CVE--2022--31160 Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')

Affected range<1.13.2
Fixed version1.13.2
CVSS Score6.1
CVSS VectorCVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N
Description

Impact

Initializing a checkboxradio widget on an input enclosed within a label makes that parent label contents considered as the input label. If you call .checkboxradio( "refresh" ) on such a widget and the initial HTML contained encoded HTML entities, they will erroneously get decoded. This can lead to potentially executing JavaScript code.

For example, starting with the following initial secure HTML:

<label>
	<input id="test-input">
	&lt;img src=x onerror="alert(1)"&gt;
</label>

and calling:

$( "#test-input" ).checkboxradio();
$( "#test-input" ).checkboxradio( "refresh" );

will turn the initial HTML into:

<label>
	<!-- some jQuery UI elements -->
	<input id="test-input">
	<img src=x onerror="alert(1)">
</label>

and the alert will get executed.

Patches

The bug has been patched in jQuery UI 1.13.2.

Workarounds

To remediate the issue, if you can change the initial HTML, you can wrap all the non-input contents of the label in a span:

<label>
	<input id="test-input">
	<span>&lt;img src=x onerror="alert(1)"&gt;</span>
</label>

References

https://blog.jqueryui.com/2022/07/jquery-ui-1-13-2-released/

For more information

If you have any questions or comments about this advisory, search for a relevant issue in the jQuery UI repo. If you don't find an answer, open a new issue.

medium 6.1: CVE--2016--7103 Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')

Affected range<1.12.0
Fixed version1.12.0
CVSS Score6.1
CVSS VectorCVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N
Description

Affected versions of jquery-ui are vulnerable to a cross-site scripting vulnerability when arbitrary user input is supplied as the value of the closeText parameter in the dialog function.

jQuery-UI is a library for manipulating UI elements via jQuery.

Version 1.11.4 has a cross site scripting (XSS) vulnerability in the closeText parameter of the dialog function. If your application passes user input to this parameter, it may be vulnerable to XSS via this attack vector.

Recommendation

Upgrade to jQuery-UI 1.12.0 or later.

critical: 0 high: 0 medium: 1 low: 0 curl 8.5.0-r0 (apk)

pkg:apk/alpine/[email protected]?os_name=alpine&os_version=3.19

medium : CVE--2024--0853

Affected range<8.6.0-r0
Fixed version8.6.0-r0
Description
critical: 0 high: 0 medium: 1 low: 0 codemirror 4.4.0 (npm)

pkg:npm/[email protected]

medium 5.3: CVE--2020--7760 Uncontrolled Resource Consumption

Affected range<5.58.2
Fixed version5.58.2
CVSS Score5.3
CVSS VectorCVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L
Description

This affects the package codemirror before 5.58.2; the package org.apache.marmotta.webjars:codemirror before 5.58.2.
The vulnerable regular expression is located in https://github.com/codemirror/CodeMirror/blob/cdb228ac736369c685865b122b736cd0d397836c/mode/javascript/javascript.jsL129. The ReDOS vulnerability of the regex is mainly due to the sub-pattern (s|/.?/)

critical: 0 high: 0 medium: 1 low: 0 aws/aws-sdk-php 3.224.0 (composer)

pkg:composer/aws/[email protected]

medium 6.0: CVE--2023--51651 Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')

Affected range<3.288.1
Fixed version3.288.1
CVSS Score6
CVSS VectorCVSS:3.1/AV:L/AC:L/PR:H/UI:N/S:U/C:H/I:H/A:N
Description

Impact

Within the scope of requests to S3 object keys and/or prefixes containing a Unix double-dot, a URI path traversal is possible. The issue exists in thebuildEndpoint method in the RestSerializer component of the AWS SDK for PHP v3 prior to 3.288.1. The buildEndpoint method relies on the Guzzle Psr7 UriResolver utility, which strips dot segments from the request path in accordance with RFC 3986. Under certain conditions, this could lead to an arbitrary object being accessed.

Versions of the AWS SDK for PHP v3 before 3.288.1 are affected by this issue.

Patches

Upgrade to the AWS SDK for PHP >= 3.288.1, if you are on version < 3.288.1.

References

RFC 3986 - https://datatracker.ietf.org/doc/html/rfc3986

For more information

If you have any questions or comments about this advisory, please contact AWS's Security team.

@mattbell87
Copy link
Member Author

@DerekCrannaford Selenium and Codeception are removed as we discussed. Let me know if you're happy with that.

@DerekCrannaford
Copy link
Contributor

@DerekCrannaford Selenium and Codeception are removed as we discussed. Let me know if you're happy with that.

@adam-buckley = Inviting you to have a quick think about this.

I like where it is heading, and now boilerplate/core do not lean on Codecept tests for actions (or feature reviews) removing Composer build for Codecept & the Selenium container stands to majorly speedup build times for various environments.

!!! BUT !!! Is it safe to skip ahead, if this hits from DEV into MASTER, while other (custom) modules demand test support?

In use, eg: CRM & STAFF modules are not yet entirely mature to run on Playwright alone.
CRM = almost there / needs conformance on actions once tests are migrated.
STAFF = no ci actions and no Playwright yet.

@mattbell87
Copy link
Member Author

Codespace patch: https://github.com/2pisoftware/codespace_dev_box/pull/42

Copy link
Contributor

@adam-buckley adam-buckley left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great, as per discussion with Derek I think we just need to rip the band-aid off and turf Codeception. I wanna give it a go locally first

@mattbell87
Copy link
Member Author

Patch for core CI here 2pisoftware/cmfive-core#278

Boilerplate still has some Codeception embedded that we need to remove. Seems to be coming from cmfiveTests.php?
https://github.com/2pisoftware/cmfive-core/actions?query=workflow%3ACI+branch%3Afix%2Fci-dev-tools

@mattbell87
Copy link
Member Author

cmfiveTests.php needs to be "de-codeceptionised" before we merge. Needs a meeting.

@mattbell87
Copy link
Member Author

Happy for this to merge now @adam-buckley @DerekCrannaford.

Needs to merge at the same time as 2pisoftware/cmfive-core#278

@mattbell87 mattbell87 merged commit f1863f5 into develop Mar 14, 2024
8 checks passed
@mattbell87 mattbell87 deleted the feat/phpunit-10 branch March 14, 2024 06:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting-review Awaiting on a code review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants